<?php

session_start();

if (!(isset($_SESSION['login']) && $_SESSION['login'] != '')) {

    header("Location: login.php");
}
//
include 'i_functions.php';
include 'i_init_client.php';
//
if ($_SERVER['REQUEST_METHOD'] == 'GET') {
    $ClientID = $_GET['ClientID'];
    //print "ClientID=" . $ClientID . "<br>";
    $ID = htmlspecialchars($ClientID);
    $_SESSION['Work'] = array();
    $db_conn = db_connect();
    $db_handle = $db_conn['db_handle'];
    $db_found = $db_conn['db_found'];

    if ($db_found) {
        include 'i_head.php';
        $HTML = "<BR><table id=\"form\" align=\"center\" cellspacing=\"0\"cellpadding=\"0\">";
        $Options = array();
        $Options['TableName'] = "client";
        $Options['ID'] = $ClientID;
        $HTML_A = BuildEnq("ClientEnq", $Options);

        $csvFile = "ClientClaims"; //this can be used to override default cols
        $Options = array();
        $Options['Name'] = "claims";
        $Options['TableOpts'] = "Align=\"center\"";
        $Options["Filter"] = "ClientID = '" . $ClientID . "'";
        $Options['Action'] = "./ClaimEnq.php?ClaimID=";
        $Options['AllowNew'] = "Y";
        //$Options['AllowNew'] = "Y";
        $Columns = array("ID", "SourceID", "ClientID", "LenderName", "LoanType", "LoanStartDate", "LoanAmount", "LoanDuration", "Status"); //default cols
        $Result = BuildDataArray("claims", $csvFile, $Columns, $Options);
        $HTML_F = Array2Table($xData, $Columns, $Options);
        print $HTML . $HTML_A . "</table>" . $HTML_F;
        include 'i_foot.html';
    }
} else {
    include 'i_head.php';
    print "new";
    include 'i_ClientEnq.php';
    include 'i_foot.html';
}
?>